package com.zboin.ucenter.controller;

import com.zboin.ucenter.model.LoginBody;
import com.zboin.ucenter.service.UserInfoService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhboom
 * @date 2025/7/20 17:32
 */
@RestController
@RequestMapping("/auth")
public class AuthController {

    private final UserInfoService userInfoService;

    public AuthController(UserInfoService userInfoService) {
        this.userInfoService = userInfoService;
    }

    @PostMapping("/login")
    public ResponseEntity<String> login(@RequestBody LoginBody loginBody) {
        return userInfoService.login(loginBody);
    }

    @PostMapping("/sms-login")
    public ResponseEntity<String> smsLogin(@RequestBody LoginBody loginBody) {
        return userInfoService.smsLogin(loginBody);
    }

    @PostMapping("/logout")
    public ResponseEntity<String> logout() {
        return userInfoService.logout();
    }

}
